<template>
  <div>
    <el-dialog v-model="dialogVisible" title="Tips" width="50%" :before-close="handleClose">
      <p style="margin:20px 0px">当前用户:</p>
      <p style="margin:20px 0px">当前角色:</p>


       <span>分配新角色</span>   <el-select v-model="uid" class="m-2" placeholder="Select">
    <el-option
      v-for="item in uList"
      :key="item.value"
      :label="item.roleDesc"
      :value="item.id"
    />
  </el-select>





      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="neww">确定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { ElMessageBox } from 'element-plus'
//引入分配封装数据请求
import {fpUser , getCharactList} from '../../../api/user.js'
let value = ref([])
let dialogVisible = ref(false)
let uid  =ref("")
let uid1 = ref("")
let uList = ref([])
let getU= async ()=>{
  let res = await getCharactList()
  uList.value = res.data.data
   console.log(123123123)
  console.log(res)
}
getU()



let init = async (id) => {

  uid1.value = id;
  dialogVisible.value = true;
  console.log("1");
  
  // console.log(res);
}

let neww = async ()=>{
    let data = {
    rid:uid.value
  }
  let res = await fpUser(uid1.value,data)
  console.log(res);
  dialogVisible = false
}
defineExpose({
  init: init
})







</script>


<style>
</style>